.bs-switch{
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
  .switch-disabled-box,
  .switch-loading-box{
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    //opacity: 0.45;
    //background-color: rgba(255,255,255,0.45);
  }
  .switch-loading{
    width: 100%;
    height: 100%;
    transform: scale(0.75);
  }
  .spinner-border{
    display: block;
    width: 100%;
    height: 100%;
    border-width: 0.1rem;
    margin: 0;
  }
}
.bs-switch-hidden-input{
  position: absolute;
  width: 0;
  height: 0;
  line-height: 0;
  opacity: 0;
  margin: 0;
}
.bs-switch-inner{
  position: relative;
  min-width: 2.75rem;
  line-height: 1.375rem;
  height: 1.375rem;
  padding: 0 .35rem 0 calc(1.125rem + .25rem + 2px);
  border: 1px solid #C0CCDA;
  border-radius: 1.375rem;
  //overflow: hidden;
  font-size: 0.75rem;
  background-color: var(--inactive-color, #C0CCDA);
  &::before,
  &::after{
    position: absolute;
    content: ' ';
  }
  &::before{
    left: 0;
    top: 0;
    z-index: 2;
    width:  100%;
    height: 100%;
    border-radius: 1.375rem;
    //transform-origin: 0 50%;
    background-color: var(--inactive-color, #C0CCDA);
    transform: scale(1);
    transition: transform 0.35s cubic-bezier(0.45, 1, 0.4, 1), -webkit-transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
  }
  &.has-inactive-color{
    &::before{
      background-color: var(--inactive-color);
    }
  }
  .switch-disabled-box,
  .switch-loading-box{
    border-radius: 1.375rem;
  }
}
.switch-circle{
  position: absolute;
  top: 50%;
  //right: .1rem;
  //left: 0;
  left: 1px;
  z-index: 5;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 1px 3px rgb(0 0 0 / 40%);
  background-color: #fff;
  transition: left 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35);
}
.bs-switch-text{
  display: block;
  position: relative;
  line-height: calc(1.375rem - 2px);
  z-index: 2;
  color: #fff;
  text-align: right;
}

.bs-switch{
  &.bs-switch-open{
    .bs-switch-inner{
      border-color: var(--primary);
      background-color: var(--primary);
    }
    .bs-switch-inner{
      padding: 0 calc(1.125rem + .25rem + 2px) 0 .35rem;
      &::before{
        transform: scale(0);
      }
      .switch-circle{
        left: calc(100% - 1.125rem - 1px);
      }
      .bs-switch-text{
        text-align: left;
      }
    }
  }
  &.bs-switch-loading{
    cursor: default;
    .switch-loading-box{
      display: block;
    }
  }
  &.bs-switch-disabled{
    opacity: 0.6;
    cursor: not-allowed;
    .switch-disabled-box{
      display: block;
      //opacity: 0.5;
    }
  }
  &.bs-switch-loading{
    opacity: 0.6;
    cursor: default;
  }
  &.bs-switch-sm{
    .bs-switch-inner{
      min-width: 2.375rem;
      line-height: 1.125rem;
      height: 1.125rem;
      padding: 0 .35rem 0 calc(0.8725rem + .25rem);
      border-radius: 1.125rem;
      &::before{
        border-radius: 1.125rem;
      }
      .switch-circle{
        left: 0;
        width: 0.875rem;
        height: 0.875rem;
      }
    }
    &.bs-switch-open{
      .bs-switch-inner{
        padding: 0 calc(0.8725rem + .25rem) 0 .35rem;
        &::before{
          transform: scale(0);
        }
        .switch-circle{
          left: calc(100% - 0.8725rem);
        }
      }
    }
    .bs-switch-text{
      line-height: calc(1.125rem - 2px);
    }
    .spinner-border{
      border-width: 1px;
    }
    .switch-disabled-box,
    .switch-loading-box{
      border-radius: 0.8725rem;
    }
  }

  &.bs-switch-lg{
    .bs-switch-inner{
      min-width: 3.125rem;
      line-height: 1.75rem;
      height: 1.75rem;
      padding: 0 .35rem 0 calc(1.375rem + .3rem);
      border-width: 2px;
      border-radius: 1.75rem;
      font-size: 0.875rem;
      &::before{
        border-radius: 1.75rem;
      }
      .switch-circle{
        left: 1px;
        width: 1.375rem;
        height: 1.375rem;
      }
    }
    &.bs-switch-open{
      .bs-switch-inner{
        padding: 0 calc(1.375rem + .3rem) 0 .35rem;
        &::before{
          transform: scale(0);
        }
        .switch-circle{
          left: calc(100% - 1.375rem - 1px);
        }
      }
    }
    .spinner-border{
      border-width: .15rem;
    }
    .bs-switch-text{
      line-height: calc(1.75rem - 4px);
    }
    .switch-disabled-box,
    .switch-loading-box{
      border-radius: 1.75rem;
    }
  }
}
